<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Introduction
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot066.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot068.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc164">12.1</A>&nbsp;&nbsp;Introduction</H2>
<A NAME="@default644"></A>
<A NAME="@default645"></A>
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> provides a general mechanism to perform macro expansion
of Prolog terms.
Macro expansion can be performed in 3 situations:
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description"><B>read macros</B><DD CLASS="dd-description">
<A NAME="@default646"></A>
<A NAME="@default647"></A>
they are expanded just after a Prolog term has been read by the
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> parser. Note that the parser is not only used during
comilation but by all
<A HREF="../bips/kernel/ioterm/read-1.html"><B>term-reading</B></A><A NAME="@default648"></A>
predicates.<BR>
<BR>
<DT CLASS="dt-description"><B>compiler macros</B><DD CLASS="dd-description">
<A NAME="@default649"></A>
<A NAME="@default650"></A>
they are expanded only during compilation and only when a term occurs
in a certain context (clause or goal).<BR>
<BR>
<DT CLASS="dt-description"><B>write macros</B><DD CLASS="dd-description">
<A NAME="@default651"></A>
<A NAME="@default652"></A>
they are expanded just before a Prolog term is printed by one of the
output predicates</DL>
In addition to transforming a term, macros can also be <I>source annotation
 aware</I>, and provide source annotation information for the transformed term if
supplied with source annotation information for the orginal term. Source annotation
 information provide source and position information for a term, and is
provided by predicate such as
 <A HREF="../bips/kernel/ioterm/read_annotated-3.html"><B>read_annotated/3</B></A><A NAME="@default653"></A>.<BR>
<BR>
Macros are attached to classes of terms specified by their functors
or by their type.
Macros obey the module system's visibility rules.
They may be either
<A HREF="../bips/kernel/modules/local-1.html"><B>local</B></A><A NAME="@default654"></A>
or
<A HREF="../bips/kernel/modules/export-1.html"><B>exported</B></A><A NAME="@default655"></A>.
The macro expansion is performed by a user-defined Prolog predicate.<BR>
<BR>
<HR>
<A HREF="umsroot066.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot068.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
